package 火车站售票实例;

public class TicketMain {
    public static void main(String[] args) {
        Runnable r = new TicketThread();
        /*Thread t1=new Thread(new TicketThread());
        Thread t2=new Thread(new TicketThread());
        Thread t3=new Thread(new TicketThread());
        如果每个进程都实例一个，每个实例都会有100张就会出问题,
        所以要3个进程公用一个实例r*/
        Thread t1 = new Thread(r);
        Thread t2 = new Thread(r);
        Thread t3 = new Thread(r);

        t1.setName("售票窗口1:");
        t2.setName("售票窗口2:");
        t3.setName("售票窗口3:");
        t1.start();
        t2.start();
        t3.start();

    }
}
